dd.cookie({
    func:function(name, value, date)
    {
        value = value || false;
        if(value === null || value)
        {
            date = date || {days:9999};
            return this.set(name, value, date);
        }
        else
        {
            return this.get(name);
        }
    },
    get:function(name)
    {
        var i, x, y, c = document.cookie.split(";");
        for (i=0;i<c.length;i++)
        {
            x = c[i].substr(0, c[i].indexOf("="));
            y = c[i].substr(c[i].indexOf("=") + 1);
            x = x.replace(/^\s+|\s+$/g, "");
            if (x == name)
            {
                return unescape(y);
            }
        }
        return null;
    },
    set:function(name, value, date)
    {
        var expire = new Date();
        var after = value === null
            ? -9999
            : ("days" in date ? date.days * 24 * 60 * 60 * 1000 : 0)
              + ("hours" in date ? date.hours * 60 * 60 * 1000 : 0)
              + ("minutes" in date ? date.hours * 60 * 1000 : 0)
              + ("seconds" in date ? date.hours * 1000 : 0);
        expire = new Date(expire.getTime() + after);
        document.cookie = name + "=" + escape(value) + "; expires=" + expire;
        return value;
    },
    remove:function(name)
    {
        var expire = new Date();
        expire = new Date(expire.getTime() - 9999);
        document.cookie = name + "=; expires=" + expire;
    }
});